class Solution {
public:
    vector<int> sortArrayByParityII(vector<int>& nums) {
        for(int even=0, odd=1; even<nums.size(); even+=2)
        {
            if(nums[even]%2) //even为奇数
            {
                while(nums[odd]%2) odd+=2; //odd找到不是奇数
                swap(nums[odd], nums[even]);
            }
        }
        return nums;
    }
};